package com.kcht.itsed.mws.alespecadapter.biz;

import com.kcht.itsed.mws.alespecadapter.exceptions.TagFieldDecodeException;
import com.kcht.itsed.mws.alespecadapter.facade.ITagDataDecoder;

/**
 * 原生EPC解码器
 * 暂时不实现TDS/TDT的标准，只提供原始HEX，
 * 不久的将来就要扩展思密达
 * 
 * @author 张文硕
 *
 */
public class NativeEpcDecoder implements ITagDataDecoder{

	@Override
	public String decode(String format, String rawHexStr)
			throws TagFieldDecodeException {
		switch(format){
		case "epc-pure":return pureEpc(rawHexStr);
		case "epc-tag":return tagEpc(rawHexStr);
		case "epc-hex":return rawHexStr;
		case "epc-decimal":return Long.toString(Long.parseLong(rawHexStr));
		}
		throw new TagFieldDecodeException("epc数据类型不存在的格式:"+format);
	}

	private String tagEpc(String rawHexStr) {
		//EPC解码未实现
		return rawHexStr;
	}

	private String pureEpc(String rawHexStr) {
		//EPC解码未实现
		return rawHexStr;
	}
	
}
